<?php

namespace app\api\service\ai;

use app\api\model\AiCompletionsDetail;
use think\Env;

class Doubao extends Base
{

    protected $type = 'doubao';

    protected $completionsUrl = 'https://ark.cn-beijing.volces.com/api/v3/chat/completions';

    public function completions(string $id, string $model, string $content, array $img = [], $deepThink = false, $webSearch = false): void
    {
        if ($img) {
            $content = [['type' => 'text', 'text' => $content]];
            foreach ($img as $val) {
                $content[] = ['type' => 'image_url', 'image_url' => ['url' => $val]];
            }
            $model = 'doubao-1.5-vision-pro-250328';
        }
        $this->completionsRequest($id, $content, $model, Env::get('doubao.apikey'));
    }
}

